package image;


import process.ImageErrorException;
import java.util.LinkedList;

/*! A vizsgalat osztalya, ezt hivja meg a felulet */
public class Analyzer {

	private PhysiObject object;
	private LinkedList<double[]> data;
	private boolean saved;
	private double sigmaM;
	private double sigmaW;

	// ! Konstruktor
	public Analyzer(double sigmaM, double sigmaW) {
		this.sigmaM = sigmaM;
		this.sigmaW = sigmaW;
		object = new PhysiObject(this.sigmaM, this.sigmaW);
		data = new LinkedList<double[]>();
		saved = true;
	}

	// ! Kiserlet inditasa
	public void start() {
		saved = false;
		object = new PhysiObject(sigmaM, sigmaW);
	}

	public void updateFromFrame(OwnImage img) throws ImageErrorException {
		object.actualize(img);
		data.offer(object.getData());
	}

	public LinkedList<double[]> getData() {
		saved = true;
		return data;
	}

	// ! PosX visszateritese
	/*
	 * ! \return int
	 */
	public double getPosX() {
		return object.getPosX();
	}

	// ! Posy visszateritese
	/*
	 * ! \return int
	 */
	public double getPosY() {
		return object.getPosY();
	}

	// ! sebesseg visszateritese
	/*
	 * ! \return double
	 */
	public double getVelocity() {
		return object.getVelocity();
	}

	// ! gyorsulas visszateritese
	/*
	 * ! \return double
	 */
	public double getAcceleration() {
		return object.getAcceleration();
	}

	public boolean isSaved() {
		return saved;
	}
}
